-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pairwise #627
Add pairwise #627
Conversation
This generic method takes iterators of vectors and supports skipping missing values. It is a more general version of `pairwise` in Distances.jl. Since methods are compatible, both packages can override a common empty function defined in another API package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good, only two comments about indexing/iterating x
and y
and one-based indexing into res
.
If I haven't missed anything, then these methods here are more generic than the generic methods in Distances.jl. I believe one could map those to the _pairwise!
"kernels" here.
EDIT: Aha, I guess one difference could be that you're assuming here that you apply pairwise
to iterators of (indexable) vectors, whereas pairwise
in Distances.jl applies to iterators of iterators.
I've pushed commits which should address all comments. I've also made two changes:
|
Nice. Just to go back for a second to the issue with
as this is the first case when the docstring is not correct (but I think it is OK as you have no way to infer the type of "one"). The second case is:
(we error although we promise to return |
Good catch. Yes I'm not sure we can do much about it. Technically we return I've also found a simple way to use |
Looks good in general (but CI fails on Julia 1.0, so probably a separate code path for it is required). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, looks good.
I've created a StatsAPI package, with a PR to define |
Could we implement a special case for Or would that be a different function entirely. |
That would have to be another function (more akin to julia> pairwise(tuple, [1, 2], [3, 4])
2×2 Matrix{Tuple{Int64, Int64}}:
(1, 3) (1, 4)
(2, 3) (2, 4) I've added a commit to import |
OK. Looks good. |
When is this expected to be merged? I'd like to use new APi in JuliaStats/MultivariateStats.jl#148. |
This generic method takes iterators of vectors and supports skipping missing values.
It is a more general version of
pairwise
in Distances.jl.Since methods are compatible, both packages can override a common empty function defined in another API package.
See nalimilan/FreqTables.jl#54. Cc: @dkarrasch @bkamins @quinnj